/*    file: PacketDumper.h
 *    desc:
 *   
 * created: 2017-01-04
 *  author: chuanjiang.zh@qq.com
 * company: 
 */ 


#if !defined PACKETDUMPER_H_
#define PACKETDUMPER_H_

#include "BasicType.h"
#include "Socket.h"


struct PacketHeader
{
	int prefix;
	int type;
	int size;
	int reserved;
	int64_t pts;
	int duration;
	int flags;
};


class PacketDumper
{
public:
	
	PacketDumper();
	~PacketDumper();

	bool open(const char* ip, int port);
	void close();
	bool isOpen();
	
	bool write(const PacketHeader& header);
	bool write(const char* data, int size);
	bool write(const uint8_t* data, int size);

protected:
	comn::Socket	m_socket;

};


#endif //PACKETDUMPER_H_

